package com.aaa.order.controller.api;

import com.aaa.entity.Order;
import com.aaa.order.service.OrderService;
import com.aaa.vo.AccountOrderVo;
import com.aaa.vo.MqVo;
import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author JYH
 * @version 1.0
 * @date 2023/3/14 20:30
 */
@RestController
@RequestMapping("/order/WXOrderPay")
public class WXOrderController {

    @Autowired
    private OrderService orderService;
    @PostMapping("/createNative")
    public Result createNative(@RequestBody Order order){
        return orderService.createNative(order);
    }
    /**
     * @author JYH
     * @date 2023/3/15 15:38
     * @description - 查询并修改订单状态
     * @param order
     */
    @PostMapping("/queryOrderStatus")
    public Result queryOrderStatus(@RequestBody Order order){
        return orderService.queryOrderStatus(order.getId());
    }
    /**
     * @author JYH
     * @date 2023/3/15 15:38
     * @description - 支付成功后修改各个表的状态码
     * @param order
     */
    @PostMapping("/updateAllState")
    public Result updateAllState(@RequestBody Order order){
        return orderService.updateAllState(order);
    }

    @PostMapping("/createMQ")
    public Result createMQ(@RequestBody MqVo mqVo){
        return orderService.createMQ(mqVo.getId());
    }
}
